package com.tyrianoid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ScreenMain extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        final Intent gameIntent = new Intent(ScreenMain.this, ScreenGame.class);
        final Intent optionsIntent = new Intent(ScreenMain.this, ScreenOptions.class);
        
        /* Start game button */
        Button bStartGame = (Button)findViewById(R.id.ButtonStart);
        
        bStartGame.setOnClickListener(new OnClickListener() 
        {
			public void onClick(View arg0) 
			{
				startActivity(gameIntent);
			}
		});
        
        /* Options button */
        Button bOptions = (Button)findViewById(R.id.ButtonOptions);
        
        bOptions.setOnClickListener(new OnClickListener() 
        {
			public void onClick(View arg0) 
			{
				startActivity(optionsIntent);
			}
		});
        
        /* Quit game button */
        Button bQuitGame = (Button)findViewById(R.id.ButtonQuit);
        
        bQuitGame.setOnClickListener(new OnClickListener() 
        {
			public void onClick(View arg0) 
			{
				stopService(gameIntent);
				
				try 
				{
					ScreenMain.this.finish();
				} 
				catch (Throwable e) 
				{
					e.printStackTrace();
				}
			}
		});
        
    }
    
    protected void onDestroy() 
    {
    	super.onDestroy();
    }
    
}